class EfEntityFormatter

Wraps an entity using an EntityMetadataWrapper.

Bundle specific subclasses are generated using EfEntityFormatter as a base class.

Methods

__construct($entity_type, stdClass|int $entity)

Wrap an entity.

setLanguage($language_prefix)

Set the language to be used. Please note that EntityMetadataWrapper always falls back to the language of the entity, if a field is not available in a given language.

EntityMetadataWrapper
entityMetadataWrapper()

Retrieve the EntityMetadataWrapper object.

mixed
entity()

Retrieve the wrapped entity.

int
id()

Retrieve the entity ID

string
url(array $options = array())

Returns an URL to the detail page of this entity.

string
label()

Retrieve the entity label

Details

at line 44
__construct($entity_type, stdClass|int $entity)

Wrap an entity.

Parameters

$entity_type Entity type
stdClass|int $entity Entity to wrap. Will load entity if ID is passed.

at line 66
setLanguage($language_prefix)

Set the language to be used. Please note that EntityMetadataWrapper always falls back to the language of the entity, if a field is not available in a given language.

See https://www.drupal.org/node/2453287 and https://www.drupal.org/node/2335357

Parameters

$language_prefix

at line 75
EntityMetadataWrapper entityMetadataWrapper()

Retrieve the EntityMetadataWrapper object.

Return Value

EntityMetadataWrapper

at line 84
mixed entity()

Retrieve the wrapped entity.

Return Value

mixed

at line 93
int id()

Retrieve the entity ID

Return Value

int

at line 103
string url(array $options = array())

Returns an URL to the detail page of this entity.

Parameters

array $options

Return Value

string

at line 113
string label()

Retrieve the entity label

Return Value

string